<?php
/**
 * RewardForm class.
 * LoginForm is the data structure for visit transcation.
 */
class RewardForm extends CFormModel
{
	public $points;
	public $customer;

	/**
	 * Declares the validation rules.
	 * The rules state that username and password are required,
	 * and password needs to be authenticated.
	 */
	public function rules()
	{
		return array(
			array('points', 'required', 'message'=>BUtils::T('cannot_be_blank_msg')),
			array('points', 'numerical', 'min'=>0.01),
			array('customer', 'required', 'message'=>BUtils::T('cannot_be_blank_msg')),
		);
	}

	/**
	 * Declares attribute labels.
	 */
	public function attributeLabels()
	{
		return array(
			'points' => 'Points',
		);
	}

	/**
	 * Authenticates the password.
	 * This is the 'authenticate' validator as declared in rules().
	 */
	public function authenticate($attribute, $params) {
		if (!$this->hasErrors()) {
			$this->addError('customer', 'No customer information');
		}
	}
}
